$OpenBSD: patch-pgadmin_frm_frmQuery_cpp,v 1.1 2014/10/24 15:01:18 dcoppa Exp $

commit f656072300b3a2736fafff0093223793ca4dd9ad
Author: Dmitriy Olshevskiy <olshevskiy87@bk.ru>
Date:   Sat Aug 9 17:15:45 2014 +0200

Prevent a crash during the update of the macro or favourite list

--- pgadmin/frm/frmQuery.cpp.orig	Wed Sep 11 14:33:57 2013
+++ pgadmin/frm/frmQuery.cpp	Thu Oct 23 09:12:29 2014
@@ -1485,6 +1485,9 @@ void frmQuery::updateMenu(bool allowUpdateModelSize)
 
 void frmQuery::UpdateFavouritesList()
 {
+	if (IsVisible() && menuBar->FindMenu(_("Fav&ourites")) == wxNOT_FOUND)
+		return;
+	
 	if (favourites)
 		delete favourites;
 
@@ -1501,6 +1504,9 @@ void frmQuery::UpdateFavouritesList()
 
 void frmQuery::UpdateMacrosList()
 {
+	if (IsVisible() && menuBar->FindMenu(_("&Macros")) == wxNOT_FOUND)
+		return;
+
 	if (macros)
 		delete macros;
 
